// pages/module/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    dataList: ["scroll-view", "swiper", "icon/text", "progress/button/checkbox/form", "input", "picker", "radio/slider","switch","action-sheet"
   ,"modal/toast","loading/navigator/audio","image","video"]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  jumpToDetile: function (e) {
    //获取当前点击的下标
    var index = e.currentTarget.dataset.index
    var name = e.currentTarget.dataset.name
    console.log(index); //获取到每个item的position
    console.log(name); //获取到每个item的name
    console.log(e.currentTarget.dataset);
    var reg = RegExp(/icon/);
    var reg1 = RegExp(/progress/);
    var reg2 = RegExp(/radio/);
    var reg3 = RegExp(/loading/);
    if (name == "scroll-view") {
      wx.navigateTo({
        url: '../modules/scroll-view/index'
      })
    } else if (name == "swiper") {
      wx.navigateTo({
        url: '../modules/swiper/index'
      })
    } else if (name.match(reg)) {
      wx.navigateTo({
        url: '../modules/icon/index'
      })
    } else if (name.match(reg1)) {
      wx.navigateTo({
        url: '../modules/progress/index'
      })
    } else if (name == "input") {
      wx.navigateTo({
        url: '../modules/input/index'
      })
    } else if (name == "picker") {
      wx.navigateTo({
        url: '../modules/picker/index'
      })
    } else if (name.match(reg2)) {
      wx.navigateTo({
        url: '../modules/radio/index'
      })
    }else if (name=="switch") {
      wx.navigateTo({
        url: '../modules/switch/index'
      })
    }else if (name=="action-sheet") {
      wx.navigateTo({
        url: '../modules/actionsheet/index'
      })
    }else if (name=="modal/toast") {
      wx.navigateTo({
        url: '../modules/modal/index'
      })
    }else if (name.match(reg3)) {
      wx.navigateTo({
        url: '../modules/loading/index'
      })
    }else if (name=="image") {
      wx.navigateTo({
        url: '../modules/image/index'
      })
    }else if (name=="video") {
      wx.navigateTo({
        url: '../modules/video/index'
      })
    }
    
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})